<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018-11-14
 * Time: 15:31
 */

namespace app\api\controller\assess;



use app\common\controller\Api;
use app\common\model\User;
use think\Db;

class Assess extends Api
{
// 无需登录的接口,*表示全部
    protected $noNeedLogin = ['*'];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = ['*'];
    public function test(){
        header('Access-Control-Allow-Origin:http://datav.aliyun.com');
        header('Access-Control-Allow-Methods:http://datav.aliyun.com');
        header('Access-Control-Allow-Headers:http://datav.aliyun.com');
        header('Access-Control-Allow-Credentials:true');
        $coo=$this->request->session();
        $a=$coo['admin']['id'];
        $id=$this->request->request('id');
       $m=array();

        for ($x=0;$x<10;$x++){
            $return = array();
            $return['name']=$id.$x;
            $return['age']=24;
            $return['sex']='男';
            $return['cookie']=$a;
            $return['num']=rand(10000, 99999);
            $return['xy']=rand(10000, 99999);
            $m[$x]=$return;
        }

       return json($m);
   }
   public function kyqq(){
       header('Access-Control-Allow-Origin:*');
       header('Access-Control-Allow-Methods:*');
       header('Access-Control-Allow-Headers:*');
       header('Access-Control-Allow-Credentials:false');
       $id=$this->request->request('id');
       $m=array();
       for ($x=0;$x<10;$x++){
           $return = array();
           $return['name']=$id.$x;
           $return['age']=24;
           $return['sex']='男';
           $return['num']=rand(10000, 99999);
           $return['xy']=rand(10000, 99999);
           $m[$x]=$return;
       }
        return json($m);
   }
    public function title(){
        header('Access-Control-Allow-Origin:http://datav.aliyun.com');
        header('Access-Control-Allow-Methods:http://datav.aliyun.com');
        header('Access-Control-Allow-Headers:http://datav.aliyun.com');
        header('Access-Control-Allow-Credentials:true');
        $coo=$this->request->session();
        $a=$coo['admin']['nickname'];
        $b=['value'=>'当前登录管理员是：'.$a];
        $m=array();
        $m[0]=$b;
        return json($m);
    }
    public function personFlow(){
        header('Access-Control-Allow-Origin:http://datav.aliyun.com');
        header('Access-Control-Allow-Methods:http://datav.aliyun.com');
        header('Access-Control-Allow-Headers:http://datav.aliyun.com');
        header('Access-Control-Allow-Credentials:true');
        $id=$this->request->request("id");
        $m=array();
        $s=0;
        if($id==1){
            $s=7;
        }elseif ($id==2){
            $s=30;
        }elseif ($id==3){
            $s=12;
        }
        for ($x=0;$x<$s;$x++){
            $return = array();
            $return['x']=$x+1;
            $return['y']=rand(10000, 99999);
            $return['z']=rand(100, 999);
            $m[$x]=$return;
        }
        return json($m);
    }
    public function productSales(){
        header('Access-Control-Allow-Origin:http://datav.aliyun.com');
        header('Access-Control-Allow-Methods:http://datav.aliyun.com');
        header('Access-Control-Allow-Headers:http://datav.aliyun.com');
        header('Access-Control-Allow-Credentials:true');
        $id=$this->request->request("id");
        $m=array();
        if($id==1){
            $s=1;
        }elseif ($id==2){
            $s=10;
        }elseif ($id==3){
            $s=100;
        }
        for ($x=0;$x<5;$x++){
            $return = array();
            $return['x']='产品'.$x;
            $return['y']=rand($s, $s*500);
            $return['z']=rand($s,$s*10);
            $m[$x]=$return;
        }
        return json($m);
    }
    public function browseRank(){
        header('Access-Control-Allow-Origin:http://datav.aliyun.com');
        header('Access-Control-Allow-Methods:http://datav.aliyun.com');
        header('Access-Control-Allow-Headers:http://datav.aliyun.com');
        header('Access-Control-Allow-Credentials:true');
        $m=array();
        for ($x=0;$x<15;$x++){
            $return = array();
            $return['value']=rand(1000, 10000);
            $return['content']='产品'.$x;
            $m[$x]=$return;
        }
        return json($m);
    }
    public function saleNum(){
        header('Access-Control-Allow-Origin:http://datav.aliyun.com');
        header('Access-Control-Allow-Methods:http://datav.aliyun.com');
        header('Access-Control-Allow-Headers:http://datav.aliyun.com');
        header('Access-Control-Allow-Credentials:true');
            $return = array();
            $return['tadaysale']=rand(10000, 100000);
            $return['plansale']=rand(10000, 100000);
            $return['sevenday']=rand(100, 1000);
            $return['sevendaynone']=rand(100, 600);
        return json($return);
    }
}